$scn()
Syntax
$scn(ELEMENT as element/string/array of ELEMENTs, CLASSNAME as string)
Arguments
- ELEMENTDOM ElementstringDOM Element Array
The element(s) to assign the class. Can be a single DOM element, an element ID specified as a string, or an array of DOM Element objects. If specifying the ID as a string, the ID corresponds to the value for the id HTML attribute for the element you wish to assign a style.
- CLASSNAMEstring
The class to assign to the element(s). Any existing classes for the element(s) will be overwritten with the specified class.
Description
The $scn() function sets the class name of the passed-in element(s). This will overwrite any class names the already being using by the element(s). Contrast this with the $acn() function which adds the class name to the element.
Example
/*Set the class name of the 'firstname' element.*/ $scn('firstname','formInput'); /*Set the class name of multiple elements. Any existing class names for the elements will be removed.*/ $scn(['firstname','lastname','address','city','state','zip'],'formInput');
An element can have more than one class name.
Use {dialog.object}.getPointer() to get the DOM element for a control.
See Also